﻿using WebServiceMGI;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using ComunesMGI.DataTypes;
using System.Collections.Generic;
using ComunesMGI.Enum;
using System;
using System.IO;
using ComunesMGI.Constantes;

namespace TestWebServiceMGI
{
    
    
    /// <summary>
    ///This is a test class for IMGIIncidentesWSTest and is intended
    ///to contain all IMGIIncidentesWSTest Unit Tests
    ///</summary>
    [TestClass()]
    public class IMGIIncidentesWSTest
    {


        private TestContext testContextInstance;

        /// <summary>
        ///Gets or sets the test context which provides
        ///information about and functionality for the current test run.
        ///</summary>
        public TestContext TestContext
        {
            get
            {
                return testContextInstance;
            }
            set
            {
                testContextInstance = value;
            }
        }

        #region Additional test attributes
        // 
        //You can use the following additional attributes as you write your tests:
        //
        //Use ClassInitialize to run code before running the first test in the class
        //[ClassInitialize()]
        //public static void MyClassInitialize(TestContext testContext)
        //{
        //}
        //
        //Use ClassCleanup to run code after all tests in a class have run
        //[ClassCleanup()]
        //public static void MyClassCleanup()
        //{
        //}
        //
        //Use TestInitialize to run code before running each test
        //[TestInitialize()]
        //public void MyTestInitialize()
        //{
        //}
        //
        //Use TestCleanup to run code after each test has run
        //[TestCleanup()]
        //public void MyTestCleanup()
        //{
        //}
        //
        #endregion


        /// <summary>
        ///A test for VisualizarIncidentesAsignados
        ///</summary>
        [TestMethod()]
        public void VisualizarIncidentesAsignadosTest()
        {
            IMGIIncidentesWS target = CreateIMGIIncidentesWS(); // TODO: Initialize to an appropriate value
            int idSistema = 0; // TODO: Initialize to an appropriate value
            string responsable = string.Empty; // TODO: Initialize to an appropriate value
            DateTime perFchIni = new DateTime(); // TODO: Initialize to an appropriate value
            DateTime perFchFin = new DateTime(); // TODO: Initialize to an appropriate value
            List<DataIncidenteReporte> expected = null; // TODO: Initialize to an appropriate value
            List<DataIncidenteReporte> actual;
            //actual = target.VisualizarIncidentesAsignados(idSistema, responsable, perFchIni, perFchFin);
            //Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }

        /// <summary>
        ///A test for UploadFile
        ///</summary>
        [TestMethod()]
        public void UploadFileTest()
        {
            IMGIIncidentesWS target = CreateIMGIIncidentesWS(); // TODO: Initialize to an appropriate value
            Stream stream = null; // TODO: Initialize to an appropriate value
            string expected = string.Empty; // TODO: Initialize to an appropriate value
            string actual;
            actual = target.UploadFile(stream);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }

        /// <summary>
        ///A test for ModificarWP
        ///</summary>
        [TestMethod()]
        public void ModificarWPTest()
        {
            IMGIIncidentesWS target = CreateIMGIIncidentesWS(); // TODO: Initialize to an appropriate value
            DataWP wp = null; // TODO: Initialize to an appropriate value
            bool cerrarTodo = false; // TODO: Initialize to an appropriate value
            target.ModificarWP(wp, cerrarTodo);
            Assert.Inconclusive("A method that does not return a value cannot be verified.");
        }

        /// <summary>
        ///A test for GetWorkPackages
        ///</summary>
        [TestMethod()]
        public void GetWorkPackagesTest()
        {
            IMGIIncidentesWS target = CreateIMGIIncidentesWS();
            int sisCod = 1;
            DataWP data = new DataWP("wp1", DateTime.Today, DateTime.Today);
            target.AddWorkPackage(sisCod, data);
            DataWP data2 = new DataWP("wp2", ConstantesMGI.FechaVacia, ConstantesMGI.FechaVacia);
            target.AddWorkPackage(sisCod, data2);
            List<DataWP> expected = new List<DataWP>();
            expected.Add(data);
            expected.Add(data2);
            List<DataWP> actual;
            actual = target.GetWorkPackages(sisCod);
            CollectionAssert.Equals(expected, actual);
         
        }

        /// <summary>
        ///A test for GetTareas
        ///</summary>
        [TestMethod()]
        public void GetTareasTest()
        {
            IMGIIncidentesWS target = CreateIMGIIncidentesWS(); // TODO: Initialize to an appropriate value
            int idSistema = 0; // TODO: Initialize to an appropriate value
            int idIncidente = 0; // TODO: Initialize to an appropriate value
            List<DataTarea> expected = null; // TODO: Initialize to an appropriate value
            List<DataTarea> actual;
            actual = target.GetTareas(idSistema, idIncidente);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }

        /// <summary>
        ///A test for GetIncidentesWP
        ///</summary>
        [TestMethod()]
        public void GetIncidentesWPTest()
        {
            IMGIIncidentesWS target = CreateIMGIIncidentesWS(); // TODO: Initialize to an appropriate value
            int idSistema = 0; // TODO: Initialize to an appropriate value
            int idWorkPackage = 0; // TODO: Initialize to an appropriate value
            List<DataIncidente> expected = null; // TODO: Initialize to an appropriate value
            List<DataIncidente> actual;
            actual = target.GetIncidentesWP(idSistema, idWorkPackage);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }

        /// <summary>
        ///A test for GetIncidentesCerradosPeriodo
        ///</summary>
        [TestMethod()]
        public void GetIncidentesCerradosPeriodoTest()
        {
            IMGIIncidentesWS target = CreateIMGIIncidentesWS(); // TODO: Initialize to an appropriate value
            List<int> sistemas = null; // TODO: Initialize to an appropriate value
            DateTime perFchIni = new DateTime(); // TODO: Initialize to an appropriate value
            DateTime perFchFin = new DateTime(); // TODO: Initialize to an appropriate value
            List<DataIncidenteReporte> expected = null; // TODO: Initialize to an appropriate value
            List<DataIncidenteReporte> actual;
            actual = target.GetIncidentesCerradosPeriodo(sistemas, perFchIni, perFchFin);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }

        /// <summary>
        ///A test for GetIncidentes
        ///</summary>
        [TestMethod()]
        public void GetIncidentesTest()
        {
            IMGIIncidentesWS target = CreateIMGIIncidentesWS(); // TODO: Initialize to an appropriate value
            int idSistema = 0; // TODO: Initialize to an appropriate value
            List<DataIncidente> expected = null; // TODO: Initialize to an appropriate value
            List<DataIncidente> actual;
            actual = target.GetIncidentes(idSistema);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }

        /// <summary>
        ///A test for GetEstadosWP
        ///</summary>
        [TestMethod()]
        public void GetEstadosWPTest()
        {
            IMGIIncidentesWS target = CreateIMGIIncidentesWS(); // TODO: Initialize to an appropriate value
            List<DataEstadoWP> expected = new List<DataEstadoWP>();
            DataEstadoWP da = new DataEstadoWP(1, "BackLog", false);
            expected.Add(da);
            DataEstadoWP da2 = new DataEstadoWP(2,"Planning" , false);
            expected.Add(da2);
            DataEstadoWP da3 = new DataEstadoWP(3,"Implementing", false);
            expected.Add(da3);
            DataEstadoWP da4 = new DataEstadoWP(4,"Testing", false);
            expected.Add(da4);
            DataEstadoWP da5 = new DataEstadoWP(5,"Validation", false);
            expected.Add(da5);
            DataEstadoWP da6 = new DataEstadoWP(6,"Demo", false);
            expected.Add(da6);
            DataEstadoWP da7 = new DataEstadoWP(7,"Cerrado", true);
            expected.Add(da7);

            List<DataEstadoWP> actual;
            actual = target.GetEstadosWP();
            CollectionAssert.Equals(expected, actual);

        }

        /// <summary>
        ///A test for GetCampos
        ///</summary>
        [TestMethod()]
        public void GetCamposTest()
        {
            //IMGIIncidentesWS target = CreateIMGIIncidentesWS();
            //int idSistema = 1;
            //List<DataCampo> expected = new List<DataCampo>();
            //DataCampo campo1 = new DataCampo(CampoSharepoint.Text,"Título", ParteMail.SUBJECT, null, true, null);
            //expected.Add(campo1);
            //DataCampo campo2 = new DataCampo(CampoSharepoint.Note,"Descripción", ParteMail.BODY, null, false, null);
            //expected.Add(campo2);
            //DataCampo campo3 = new DataCampo(CampoSharepoint.DateTime, "Fecha Propuesto", ParteMail.NINGUNO, null, true, null);
            //expected.Add(campo3);
            //List<string> opcionesCampo3 = new List<string>();
            //opcionesCampo3.Add("Christian Oroza");
            //opcionesCampo3.Add("Marcelo Suarez");
            //DataCampo campo4 = new DataCampo(CampoSharepoint.Choice, "Reportado por", ParteMail.NINGUNO, "Christian Oroza", true, opcionesCampo3);
            //expected.Add(campo4);
            //List<DataCampo> actual;
            //actual = target.GetCampos(idSistema, Lista.Incidentes);
            //Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }

        /// <summary>
        ///A test for ChkWpIncidentesOTareasSinCerrar
        ///</summary>
        [TestMethod()]
        public void ChkWpIncidentesOTareasSinCerrarTest()
        {
            IMGIIncidentesWS target = CreateIMGIIncidentesWS(); // TODO: Initialize to an appropriate value
            int wkpCod = 7;
            bool expected = true; 
            //para que funcione el work package con codigo 7 debe tener algun incidente asignado sin cerrar
            bool actual;
            actual = target.ChkWpIncidentesOTareasSinCerrar(wkpCod);
            Assert.AreEqual(expected, actual);
            
        }


        ///A test for ChkWpIncidentesOTareasSinCerrar
        ///</summary>
        [TestMethod()]
        public void ChkWpIncidentesOTareasSinCerrarTest2()
        {
            IMGIIncidentesWS target = CreateIMGIIncidentesWS(); // TODO: Initialize to an appropriate value
            int wkpCod = 6;
            bool expected = false;
            //para que funcione el work package con codigo 6 no debe tener algun incidente asignado sin cerrar
            bool actual;
            actual = target.ChkWpIncidentesOTareasSinCerrar(wkpCod);
            Assert.AreEqual(expected, actual);

        }
        /// <summary>
        ///A test for AsociarIncidentesWP
        ///</summary>
        [TestMethod()]
        public void AsociarIncidentesWPTest()
        {
            IMGIIncidentesWS target = CreateIMGIIncidentesWS(); // TODO: Initialize to an appropriate value
            int idSistema = 0; // TODO: Initialize to an appropriate value
            int idWorkPackage = 0; // TODO: Initialize to an appropriate value
            List<int> incidentes = null; // TODO: Initialize to an appropriate value
            target.AsociarIncidentesWP(idSistema, idWorkPackage, incidentes);
            Assert.Inconclusive("A method that does not return a value cannot be verified.");
        }

        /// <summary>
        ///A test for AsignarResponsable
        ///</summary>
        [TestMethod()]
        public void AsignarResponsableTest()
        {
            IMGIIncidentesWS target = CreateIMGIIncidentesWS(); // TODO: Initialize to an appropriate value
            int idSistema = 0; // TODO: Initialize to an appropriate value
            int idIncidente = 0; // TODO: Initialize to an appropriate value
            DataTarea tarea = null; // TODO: Initialize to an appropriate value
            DataUsuario usuario = null; // TODO: Initialize to an appropriate value
            bool expected = false; // TODO: Initialize to an appropriate value
            bool actual;
            actual = target.AsignarResponsable(idSistema, idIncidente, tarea, usuario);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }

        /// <summary>
        ///A test for AdjuntarArchivoIncidente
        ///</summary>
        [TestMethod()]
        public void AdjuntarArchivoIncidenteTest()
        {
            IMGIIncidentesWS target = CreateIMGIIncidentesWS(); // TODO: Initialize to an appropriate value
            string nombreArchivo = string.Empty; // TODO: Initialize to an appropriate value
            int idSistema = 0; // TODO: Initialize to an appropriate value
            int idIncidente = 0; // TODO: Initialize to an appropriate value
            string nroTemp = string.Empty; // TODO: Initialize to an appropriate value
            bool expected = false; // TODO: Initialize to an appropriate value
            bool actual;
            actual = target.AdjuntarArchivoIncidente(nombreArchivo, idSistema, idIncidente, nroTemp);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }

        /// <summary>
        ///A test for AddWorkPackage
        ///</summary>
        [TestMethod()]
        public void AddWorkPackageTest()
        {
            IMGIIncidentesWS target = CreateIMGIIncidentesWS();
            int idSistema = 1;
            DataWP workPackage = new DataWP("WorkPackage1",  DateTime.Today, DateTime.Today);
            int expected = 1; 
            int actual;
            actual = target.AddWorkPackage(idSistema, workPackage);
            Assert.AreEqual(expected, actual);
            workPackage.Id = expected;
            workPackage.IdSistema = idSistema;
            workPackage.EsfuerzoRestante = 0;
            workPackage.EsfuerzoTotal = 0;
            workPackage.Estado = new DataEstadoWP(1, "BackLog", false);
            workPackage.FechaEntrega = ConstantesMGI.FechaVacia;
            List<DataWP> workPackages = target.GetWorkPackages(1);
            CollectionAssert.Contains(workPackages, workPackage);
        }

        /// <summary>
        ///A test for AddTarea
        ///</summary>
        [TestMethod()]
        public void AddTareaTest()
        {
            IMGIIncidentesWS target = CreateIMGIIncidentesWS(); // TODO: Initialize to an appropriate value
            int idSistema = 0; // TODO: Initialize to an appropriate value
            int idIncidente = 0; // TODO: Initialize to an appropriate value
            List<DataCampo> campos = null; // TODO: Initialize to an appropriate value
            DataAltaTarea expected = null; // TODO: Initialize to an appropriate value
            DataAltaTarea actual;
            actual = target.AddTarea(idSistema, idIncidente, campos);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }

        internal virtual IMGIIncidentesWS CreateIMGIIncidentesWS()
        {
            // TODO: Instantiate an appropriate concrete class.
            IMGIIncidentesWS target = new MGIIncidentesWS();
            return target;
        }

        /// <summary>
        ///A test for AddIncidente
        ///</summary>
        [TestMethod()]
        public void AddIncidenteTest()
        {
            IMGIIncidentesWS target = CreateIMGIIncidentesWS(); // TODO: Initialize to an appropriate value
            DataSistema incidente = null; // TODO: Initialize to an appropriate value
            DataAltaIncidente expected = null; // TODO: Initialize to an appropriate value
            DataAltaIncidente actual;
            actual = target.AddIncidente(incidente);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }
    }
}
